#include <bits/stdc++.h>
using namespace std;
int a[1000000];
int dp[1000000];

int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    dp[i] = 1;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= i - 1; j++) {
      if (a[j] < a[i])
        dp[i] = max(dp[i], dp[j] + 1);
    }
  }
  cout << *max_element(dp + 1, dp + n + 1);

  return 0;
}
